Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| StartTrace | |
100.00% |
7 / 7 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTraceId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isSampled | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Nivseb\LaraMonitor\Struct\Tracing; |
| 4 | |
| 5 | use Nivseb\LaraMonitor\Struct\Traits\CanGenerateId; |
| 6 | |
| 7 | class StartTrace extends AbstractTrace |
| 8 | { |
| 9 | use CanGenerateId; |
| 10 | public readonly bool $sampled; |
| 11 | public readonly float $sampleRate; |
| 12 | |
| 13 | protected readonly string $id; |
| 14 | protected readonly string $traceId; |
| 15 | |
| 16 | public function __construct(bool $sampled, float $sampleRate) |
| 17 | { |
| 18 | $this->id = $this->generateId(8); |
| 19 | $this->traceId = $this->generateId(16); |
| 20 | $this->sampled = $sampled; |
| 21 | $this->sampleRate = $sampleRate; |
| 22 | } |
| 23 | |
| 24 | public function getId(): string |
| 25 | { |
| 26 | return $this->id; |
| 27 | } |
| 28 | |
| 29 | public function getTraceId(): string |
| 30 | { |
| 31 | return $this->traceId; |
| 32 | } |
| 33 | |
| 34 | public function isSampled(): bool |
| 35 | { |
| 36 | return $this->sampled; |
| 37 | } |
| 38 | } |